import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *
testCase="DBshop006_删除取消的订单流程"
firefox=openBrowser(urlAdmin) #调用函数打开网址
DBshopLoginAdmin(firefox)
DBshopEnterMenu2(firefox,'销售管理','订单管理')
s=firefox.find_element_by_xpath("//body").text
l="订单数\："
r="\)"
num1=reGetString(s,l,r)
firefox.find_element_by_xpath('//select[@id="order_state"]/option[2]').click()
firefox.find_element_by_xpath('//button').click()
firefox.find_element_by_name('order_id[]').click()
firefox.find_element_by_xpath('//select[@id="allEdit"]/option[2]').click()
firefox.find_element_by_xpath('//button[contains(text(),"提交操作")]').click()
firefox.switch_to.alert.accept()
time.sleep(5)
s=firefox.find_element_by_xpath("//body").text
num2=reGetString(s,l,r)
if int(num1)==int(num2)+1:
    writeLog("%s 测试通过" % (testCase))
else:
    writeLog("%s 测试失败" % (testCase))
    getPhoto(firefox)
firefox.quit()